package com.lrs.java.spring.core.$03_DependencyInject;

import com.lrs.java.spring.core.$01_helloworld.HelloApi;

public class HelloApiDecorator implements HelloApi {

	private HelloApi helloApi;

	private String message;

	public HelloApiDecorator() {
	}

	//可以通过构造器注入
	public HelloApiDecorator(HelloApi helloApi) {
		this.helloApi = helloApi;
	}

	//可以通过setter注入
	public void setHelloApi(HelloApi helloApi) {
		this.helloApi = helloApi;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getMessage() {
		return message;
	}

	@Override
	public void sayHello() {
		System.out.println("==========装饰开始===========");
		helloApi.sayHello();
		System.out.println("message: " + getMessage());
		System.out.println("==========装饰完毕===========");
	}

}
